#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright @ 2014 OPS, Qunar Inc. (qunar.com)
#
# Author: tingfang.bao <tingfang.bao@qunar.com>
# DateTime: 15-3-11 下午12:25
from flask import Flask, render_template, flash, redirect, url_for

app = Flask(__name__)
app.secret_key = '1234'


@app.route('/')
def index():
    return render_template('index.html')


@app.route('/page')
def page():
    return render_template('page.html')


@app.route('/filter')
def filter1():
    return render_template('filter.html')


# 没有分类
@app.route('/flash', methods=['GET', 'POST'])
def flash_func():
    flash('message1')
    flash('message2', 'error')
    flash('message3', 'info')
    return redirect(url_for('index'))


@app.route('/flash1', methods=['GET', 'POST'])
def flash_func1():
    flash('message1')
    flash('message2', 'error')
    flash('message3', 'info')
    return redirect(url_for('page'))

@app.route('/flash2', methods=['GET', 'POST'])
def flash_func2():
    flash('message1')
    flash('message2', 'error')
    flash('message3', 'info')
    return redirect(url_for('filter1'))


if __name__ == '__main__':
    app.run(debug=True)